<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>添加自运营号</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- 确保适当的绘制和触屏缩放 -->
	<link rel="stylesheet" href="{$url_css}bootstrap.min.css" type="text/css">
	<link rel="stylesheet" href="{$url_css}admin.css" type="text/css">
	<link rel="stylesheet" href="{$url_js}fileinput/css/fileinput.min.css" type="text/css">
	<script type="text/javascript" src="{$url_js}jquery-1.12.0.min.js"></script>
	<script type="text/javascript" src="{$url_js}calendar/WdatePicker.js"></script>
	<script type="text/javascript" src="{$url_js}fileinput/js/fileinput.min.js"></script>
	<script type="text/javascript" src="{$url_js}fileinput/js/locales/zh.js"></script>
	<style type="text/css">
		{literal}
		.file-drop-zone {
			min-height: 198px;
		}

		.file-thumbnail-footer {
			display: none;
		}

		.audio .file-preview-frame {
			height: 28px !important;
		}

		.audio .file-drop-zone {
			min-height: 92px;
		}

		.div_btn {
			width: 100%;
		}

		.div_btn input {
			width: 7%;
		}

		{/literal}
	</style>
</head>
<body>

<div class="container" style="width:96%">
	<form action="?do=Updata" method="post" enctype="multipart/form-data">
		<input type="hidden" name="id" value="{if $info}{$info.UserId}{/if}"/>
		<table class="table table-bordered table-striped" align="center">
			<tbody>
			<tr>
				<td colspan="3"><h5>{if $info}修改自运营号{else}添加自运营号{/if}</h5></td>
			</tr>
			<tr>
				<td style="width: 300px;">
					<span style="color: red">*</span>账号昵称
					(仅限2-10位字符)：<br/>
				</td>
				<td><input type="text" class="form-control" id="nickName" name="nickName" placeholder="账号昵称" value="{if $info}{$info.NickName}{/if}"
				           style="width: 300px; float: left;"/>
					<span style="display: inline-block; float: left; margin-left: 10px; line-height: 34px;"></span>
				</td>
			</tr>


			<tr>
				<td>
					上传头像<br/>
					仅限jpeg、jpg、png、bmp、gif格式<br/>
					不超过2M<br/>
					尺寸最小180*180<br/>
					不上传为默认头像<br/>
				</td>
				<td>
					<input type="file" class="file_img" id="head" name="head" minW="300" minH="300" data="{$info.HeadUrl}" />
				</td>
			</tr>
			<tr>
				<td>&nbsp;</td>
				<td>
					<div id="div_btn">
						<input type="submit" id="add_btn" class="btn btn-primary" value="保存"/>
						<input type="button" onclick="history.back()" class="btn btn-primary" value="取消"/>
					</div>
				</td>
			</tr>
			</tbody>
		</table>
	</form>
</div>
<div>&nbsp;</div>

{literal}
	<script type="text/javascript">
        $("#add_btn").click(function () {
            var Name = $.trim($("#nickName").val());

            if (Name.length < 2 || 10 < Name.length) {
                top.swal('出错了', '账号名称仅限2-10位字符！', 'error');
                return false;
            }

            return true;
        });

        //ajax验证同源名称
        $("#nickName").blur(function () {
            var _this = $(this);
            var Name = $.trim(_this.val());
            if (Name == '') {
                _this.siblings('span').css("color", 'red').html("名称不能为空！");
            }
        });



        //图片上传初始化
        $(".file_img").each(function () {
            var accept = ['jpg', 'png', 'gif'];
            var input_obj = $.extend(uploadObj(), {
                allowedPreviewTypes: ['image'],
                allowedFileTypes: ['image'],
                allowedFileExtensions: accept,//接收的文件后缀
                resizeImage: true
            });

            $(this).attr("accept", '.' + accept.join(',.'));
            var img_url = $(this).attr("data");
            if (img_url != '') {
                input_obj.initialPreview = [
                    '<img src="' + img_url + '" class="kv-preview-data file-preview-image" style="width:auto;height:160px;">'
                ];
            }

            var maxSize = $(this).attr("maxSize");
            if (maxSize > 0) {
                input_obj.maxFileSize = maxSize;
            }

            var minW = $(this).attr("minW");
            if (minW > 0) {
                input_obj.minImageWidth = minW;
            }

            var minH = $(this).attr("minH");
            if (minH > 0) {
                input_obj.minImageHeight = minH;
            }


            $(this).fileinput(input_obj)
        });

        //上传插件对象
        function uploadObj() {
            return obj = {
                showCaption: false,
                showClose: false,
                uploadAsync: false,
                showRemove: false,
                showUpload: false,
                uploadUrl: "#",
                language: 'zh', //设置语言
                dropZoneEnabled: false,
            };
        }

	</script>
{/literal}

</body>
</html>